home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
A.C.E. 3
/
ACE CD 3.iso
/
files
/
utils
/
aplay200.lha
/
APlayer
/
Files
/
Developer.lha
/
Examples
/
apFredLibrary.S
next >
Wrap
Text File
|
1995-12-23
|
20KB
|
1,137 lines
; $VER: Fred.library 2.21
;
INCDIR "Includes3.0:Include3.0/"
INCLUDE "Exec/Types.i"
INCLUDE "Own/SystemBases.i"
INCLUDE "Own/SystemStructures.i"
INCLUDE "Own/SystemOffsets.i"
INCLUDE "Own/AccessiblePlayer.i"
VERSION = 2
REVISION = 21
TRUE = -1
FALSE = 0
; Library Data
LN_Name = 10
LN_Type = 8
NT_Library = 9
LIBB_Summing = 0
LIBB_Changed = 1
LIBB_SumUsed = 2
LIBB_DelExp = 3
LIBF_Summing = 1<<LIBB_Summing
LIBF_Changed = 1<<LIBB_Changed
LIBF_SumUsed = 1<<LIBB_SumUsed
LIBF_DelExp = 1<<LIBB_DelExp
; Macros
INBYTE MACRO
dc.b %11100000,0
dc.w \1
dc.b \2,0
ENDM
INWORD MACRO
dc.b %11010000,0
dc.w \1,\2
ENDM
INLONG MACRO
dc.b %11000000,0
dc.w \1
dc.l \2
ENDM
; Library Base Structure
STRUCTURE LibraryStruct,0
STRUCT LIB_Node,14
UBYTE LIB_Flags
UBYTE LIB_Pad
UWORD LIB_NegSize
UWORD LIB_PosSize
UWORD LIB_Version
UWORD LIB_Revision
APTR LIB_IDString
ULONG LIB_Sum
UWORD LIB_OpenCnt
LONG LIB_SegList
LABEL LibraryStruct_SIZEOF
SECTION Fred.library,CODE
START moveq #0,d0
rts
;------------------------------------------------------------------------------
LIBNAME dc.b "apFred.library",0
LIBID dc.b "Fred.library 2.21 (17-January-1995)",0
even
;------------------------------------------------------------------------------
; ROMTAG Structure
;
ROMTAG dc.w $4afc ;ROMTAG Indentifier
dc.l romtag
dc.l slut
dc.b $80 ;Flags
dc.b version
dc.b $09 ;Type Of Module
dc.b $00 ;Initialization Priority
dc.l libname
dc.l libid
dc.l autinit ;Pointer To AUTOINIT Table
;------------------------------------------------------------------------------
; AUTOINIT Table
;
AUTINIT dc.l LibraryStruct_SIZEOF ;Size Of Structure AFTER Base Address
dc.l vector ;Pointer To Vector Table
dc.l inittab ;Pointer To Init Structure
dc.l init ;Pointer To Init Routine
;------------------------------------------------------------------------------
; Init Table
;
INITTAB INBYTE LN_Type,NT_Library
INBYTE LIB_Flags,LIBF_SumUsed!LIBF_Changed
INWORD LIB_Version,version
INWORD LIB_Revision,revision
INLONG LN_Name,libname
INLONG LIB_IDString,libid
dc.l 0
;------------------------------------------------------------------------------
; Vector Table
;
VECTOR dc.w -1
dc.w opnlib-vector,clslib-vector,expunge-vector,extfunc-vector
dc.w FP_GetTags-vector
dc.w -1
;------------------------------------------------------------------------------
; Init Routine
;
INIT movem.l d1-d7/a0-a6,-(sp)
move.l d0,a4 ;Base Address
move.l a0,LIB_SegList(a4)
move.l a4,d0
movem.l (sp)+,d1-d7/a0-a6
rts
;------------------------------------------------------------------------------
; Offset -6: Open Library
;
OPNLIB addq.w #1,LIB_OpenCnt(a6)
bclr #LIBB_DelExp,LIB_Flags(a6)
move.l a6,d0
rts
;------------------------------------------------------------------------------
; Offset -12: Close Library
;
CLSLIB moveq #0,d0
subq.w #1,LIB_OpenCnt(a6)
bne.b clslibo
btst #LIBB_DelExp,LIB_Flags(a6)
bne.b expunge
CLSLIBO rts
;------------------------------------------------------------------------------
; Offset -18: Expunge
;
EXPUNGE movem.l d1-d7/a0-a6,-(sp)
move.l a6,a4
tst.w LIB_OpenCnt(a4)
beq.b exp1
bset #LIBB_DelExp,LIB_Flags(a4)
moveq #0,d0
bra.b expungo
EXP1 move.l 4.w,a6
move.l LIB_SegList(a4),d2
move.l a4,a1
jsr Remove(a6)
move.l a4,a1
moveq #0,d0
move.w LIB_NegSize(a4),d0
sub.l d0,a1
add.w LIB_PosSize(a4),d0
jsr FreeMem(a6)
move.l d2,d0
EXPUNGO movem.l (sp)+,d1-d7/a0-a6
rts
;------------------------------------------------------------------------------
; Offset -24: ExtFunc
;
EXTFUNC moveq #0,d0
rts
;------------------------------------------------------------------------------
;******************************************************************************
;* Fred Player
;******************************************************************************
;------------------------------------------------------------------------------
; Offset -30: GetTags
;
; IN : Nothing
;
; OUT: A0 = Pointer To A TagList
;
FP_GetTags
lea FP_Tags(pc),a0
rts
FP_Tags dc.l APT_RequestVersion,2
dc.l APT_Check,FP_TestModule
dc.l APT_InitPlayer,FP_InitPlayer
dc.l APT_EndPlayer,FP_EndPlayer
dc.l APT_InitSound,FP_InitSound
dc.l APT_EndSound,FP_EndSound
dc.l APT_Interrupt,FP_PlayModule
dc.l APT_PlayerName,fpname
dc.l APT_Description,fpdes
dc.l APT_SubSong,FP_SubSong
dc.l APT_Pause,TRUE
FP_Skip dc.l TAG_SKIP,0
dc.l APT_ChangeChannel,FP_ChangeChannel
dc.l APT_Volume,TRUE
dc.l TAG_END
FPNAME dc.b "Fred Player",0
FPDES dc.b "Original player by JC & Fred.",10
dc.b "Adapted by Tax.",10,10
dc.b "This player will not use the",10
dc.b "player in the module, except if",10
dc.b "it's a player it can't reconise.",0
even
;------------------------------------------------------------------------------
; TestModule
;
; IN : A1 = Address
;
; OUT: D0 = Success (0=Unknown, 1=Ok, 2=Error)
;
FP_TestModule
movem.l d1-d2/a1,-(sp)
cmp.w #$4efa,(a1)
bne.b .tsmod3
cmp.w #$4efa,4(a1)
bne.b .tsmod3
cmp.w #$4efa,8(a1)
bne.b .tsmod3
cmp.w #$4efa,12(a1)
bne.b .tsmod3
moveq #0,d1
move.w 2(a1),d1
add.l d1,a1
moveq #4-1,d2
.TSMOD1 cmp.w #$123a,2(a1)
bne.b .tsmod2
cmp.w #$b001,6(a1)
beq.b .tsmod4
.TSMOD2 addq.l #2,a1
dbra d2,.tsmod1
.TSMOD3 moveq #0,d0 ;Unknown
bra.b .tsmodo
.TSMOD4 move.w 4(a1),d1
add.l d1,a1
moveq #0,d1
move.b 4(a1),d1
addq.w #1,d1
lea maxtune(pc),a1
move.w d1,(a1)
moveq #1,d0 ;Ok
.TSMODO movem.l (sp)+,d1-d2/a1
rts
;------------------------------------------------------------------------------
; InitPlayer
;
; IN : A1 = Address
;
; OUT: D1 = Success (0=Error)
;
FP_InitPlayer
movem.l d0/a0-a1,-(sp)
lea module(pc),a0
move.l a1,(a0)
lea global(pc),a0
move.l a5,(a0)
move.w 2(a1),d0
lea 2(a1,d0.w),a1 ;Set New Address
move.l a1,d0
sub.l module(pc),d0
lea modadd(pc),a0
move.l d0,(a0)
; Start To See If We Can Use The Intern Player
moveq #0,d0 ;Set Flag As Extern
moveq #2,d1
cmp.w #$47fa,$86(a1)
bne.b .inipl1
cmp.w #$33fc,$8e(a1)
bne.b .inipl1
cmp.w #$1019,$1ba(a1)
bne.b .inipl1
cmp.w #$7200,$1be(a1)
bne.b .inipl1
cmp.w #$51cd,$3cc(a1)
bne.b .inipl1
cmp.w #$4e75,$3d0(a1)
bne.b .inipl1
cmp.w #$117c,$7be(a1)
bne.b .inipl1
cmp.w #$116d,$7ca(a1)
bne.b .inipl1
cmp.w #$47fa,$7d6(a1)
bne.b .inipl1
moveq #1,d0 ;Set Flag As Intern
moveq #0,d1
.INIPL1 lea useply(pc),a0
move.b d0,(a0) ;Store Use Player Flag
lea FP_Skip(pc),a0
move.l d1,4(a0)
lea v1str,a0
moveq #0,d0
move.w #(4*128+$32*2)/2-1,d1
.INIPL2 move.w d0,(a0)+ ;Clear BSS Area
dbra d1,.inipl2
move.l APG_AllocChannels(a5),a0
jsr (a0)
move.l d0,d1
movem.l (sp)+,d0/a0-a1
rts
;------------------------------------------------------------------------------
; EndPlayer
;
; IN : A1 = Address
;
; OUT: Nothing
;
FP_EndPlayer
move.l a0,-(sp)
move.l APG_FreeChannels(a5),a0
jsr (a0)
move.l (sp)+,a0
rts
;------------------------------------------------------------------------------
; InitSound
;
; IN : A1 = Address
;
; OUT: Nothing
;
FP_InitSound
movem.l d0-d7/a0-a6,-(sp)
lea useply(pc),a0
tst.b (a0)
beq.b .inisn1
move.l a1,a0
add.l modadd(pc),a0
lea fredp(pc),a1
.INISN1 move.w APG_Tune(a5),d0
ext.l d0
jsr (a1) ;Init Module
movem.l (sp)+,d0-d7/a0-a6
rts
;------------------------------------------------------------------------------
; EndSound
;
; IN : A1 = Address
;
; OUT: Nothing
;
FP_EndSound
movem.l d0-d7/a0-a6,-(sp)
lea useply(pc),a0
tst.b (a0)
beq.b .endsn1
lea fredp(pc),a1
.ENDSN1 moveq #0,d1
jsr 8(a1) ;Stop Module Playing
moveq #0,d0
move.w d0,$dff0a8
move.w d0,$dff0b8
move.w d0,$dff0c8
move.w d0,$dff0d8
movem.l (sp)+,d0-d7/a0-a6
rts
;------------------------------------------------------------------------------
; PlayModule
;
; IN : A1 = Address
; D1 = VBlank/Cia (0=CIA)
;
; OUT: Nothing
;
FP_PlayModule
movem.l d0-d7/a0-a6,-(sp)
lea useply(pc),a0
tst.b (a0)
beq.b .plymo1
move.l a1,a0
lea fredp(pc),a1
.PLYMO1 jsr 4(a1) ;Play Module
movem.l (sp)+,d0-d7/a0-a6
rts
;------------------------------------------------------------------------------
; SubSong
;
; IN : A1 = Address
;
; OUT: A0 = Pointer To Two SubSongs Words
;
FP_SubSong
lea maxtune(pc),a0
rts
;------------------------------------------------------------------------------
; ChangeChannel
;
; IN : A1 = Address
; D1 = Channel (0-3)
; D2 = State (0=Off 1=On)
;
; OUT: Nothing
;
FP_ChangeChannel
movem.l d0-d4/a0,-(sp)
moveq #0,d0
moveq #-1,d3
bclr d1,d3
tst.b d2
beq.b .chgch1
bset d1,d0
.CHGCH1 lea chan(pc),a0
move.b (a0),d4
and.b d3,d4
or.b d0,d4
move.b d4,(a0)
movem.l (sp)+,d0-d4/a0
rts
;------------------------------------------------------------------------------
GLOBAL dc.l 0
MODULE dc.l 0
MODADD dc.l 0
MAXTUNE dc.w 0,0
D800 dc.w 0
USEPLY dc.b 0
CURSNG dc.b 0
CUROFF dc.b 0
FPLAYIT dc.b -1
D7FF dc.b 0
D802 dc.b 0
CHAN dc.b 15
even
;------------------------------------------------------------------------------
MULTAB dc.w $2000,$1e30,$1c80,$1ae8,$1968,$17f8,$16a0,$1558
dc.w $1428,$1308,$11f8,$10f0,$1000,$f18,$e40,$d74,$cb4
dc.w $bfc,$b50,$aac,$a14,$984,$8fc,$878,$800,$78c,$720
dc.w $6ba,$65a,$5fe,$5a8,$556,$50a,$4c2,$47e,$43c,$400
dc.w $3c6,$390,$35d,$32d,$2ff,$2d4,$2ab,$285,$261,$23f
dc.w $21e,$200,$1e3,$1c8,$1ae,$196,$17f,$16a,$155,$142
dc.w $130,$11f,$10f,$100,$f1,$e4,$d7,$cb,$bf,$b5,$aa
dc.w $a1,$98,$8f,$87
;------------------------------------------------------------------------------
; Fred Player
;
FREDP jmp fredini(pc)
jmp fredply(pc)
jmp fredstp(pc)
jmp fredqqq(pc)
;------------------------------------------------------------------------------
; Initialize Module
;
FREDINI move.b $895-$12(a0),d1 ;Number Of Songs
cmp.b d1,d0
bhi.b fredstp
lea cursng(pc),a3
move.b d0,(a3)
lea $897-$12(a0),a2
lea curoff(pc),a4
add.l d0,a2
move.b (a2),(a4)
lsl.l #3,d0
moveq #0,d6
lea v1str,a4
moveq #4-1,d7
.FREIN1 move.w #1,$20(a4)
clr.w $3a(a4)
lea $b0e-$12(a0),a1
move.l a1,a2
lea (a1,d0.w),a1
add.w (a1,d6.w),a2
move.l a2,(a4)
move.l a0,a3
add.l $8a6-$12(a0),a3
sub.l modadd(pc),a3
add.w (a2),a3
move.l a3,8(a4)
st $1e(a4)
lea $80(a4),a4
addq.b #2,d6
dbra d7,.frein1
lea fplayit(pc),a3
clr.b (a3)
lea d800(pc),a3
move.w #$1000,(a3)
lea d7ff(pc),a3
sf (a3)
rts
;------------------------------------------------------------------------------
; ???
;
FREDQQQ lea d802(pc),a3
move.b d0,(a3)
lea d7ff(pc),a3
st (a3)
rts
;------------------------------------------------------------------------------
; Stop Module
;
FREDSTP lea fplayit(pc),a3
move.b #$ff,(a3)
move.w #15,$dff096
rts
;------------------------------------------------------------------------------
; Play Module
;
FREDPLY lea fplayit(pc),a3
tst.b (a3)
beq.b fp0b6
rts
FP0B6 moveq #0,d4
moveq #4-1,d5
FP0BA moveq #0,d7
move.w d5,d0
lsl.w #4,d0
lea $dff000,a6
add.w d0,a6
move.l d5,d0
lsl.l #7,d0
lea v1str,a0
add.l d0,a0
move.l 8(a0),a1
move.l 12(a0),a5
tst.b $1e(a0)
bne.b fp12a
st $1e(a0)
moveq #0,d0
move.w 4(a5),d0
beq.b fp11c
bmi.b fp12a
move.l module(pc),a2
add.l (a5),a2
add.l d0,a2
move.w 6(a5),d1
sub.w d0,d1
tst.b $27(a5)
beq.b fp110
lea $40(a0),a2
FP110 btst d5,chan
beq.b fp12a
move.l a2,$a0(a6) ;Address
move.w d1,$a4(a6) ;Length
bra.b fp12a
FP11C lea empsamp,a2
btst d5,chan
beq.b fp12a
move.l a2,$a0(a6) ;Address
move.w #$32,$a4(a6) ;Length
FP12A subq.w #1,$20(a0)
tst.w $20(a0)
beq.b fp156
cmp.w #1,$20(a0)
bne.w fp3e4
cmp.b #$a0,(a1)
bpl.w fp3e4
moveq #0,d1
bset d5,d1
move.w d1,$dff096 ;Turn Off DMA
bra.w fp3e4
FP156 move.l 12(a0),a5
moveq #0,d0
move.b (a1)+,d0
bpl.w fp2c0
cmp.b #$83,d0
beq.b fp1a0
cmp.b #$82,d0
beq.b fp1bc
cmp.b #$81,d0
beq.b fp1cc
cmp.b #$84,d0
beq.w fp21c
cmp.b #$80,d0
beq.w fp23c
neg.b d0
moveq #0,d1
move.b curoff(pc),d1
mulu d1,d0
move.w d0,$20(a0)
move.l a1,8(a0)
bra.w fp3e4
FP1A0 move.b (a1)+,d0
move.l module(pc),a5
add.l modadd(pc),a5
add.l $8a2-$12(a5),a5
sub.l modadd(pc),a5
lsl.w #6,d0
add.l d0,a5
move.l a5,12(a0)
moveq #-1,d7
move.l a1,8(a0)
bra.b fp156
FP1BC move.b (a1)+,d0
lea curoff(pc),a4
move.b d0,(a4)
move.l a1,8(a0)
bra.b fp156
FP1CC move.b (a1)+,d0
move.l d0,d2
moveq #0,d1
move.b curoff(pc),d1
mulu d2,d1
move.w d1,$2a(a0)
lea multab(pc),a2
clr.w d1 ;;Added By Tax
move.l a5,d2 ;;
beq.b fp1cca ;;Removed Enforcer Hit!!!!
move.w 8(a5),d1
FP1CCa moveq #10,d2
move.b (a1)+,d0
move.b d0,$23(a0)
lsl.w #1,d0
move.w (a2,d0.w),d0
mulu d1,d0
lsr.l d2,d0
move.w d0,$1a(a0)
move.w #0,$24(a0)
moveq #0,d0
moveq #0,d1
move.b (a1)+,d0
move.b curoff(pc),d1
mulu d1,d0
move.w d0,$16(a0)
st $15(a0)
move.l a1,8(a0)
bra.w fp156
FP21C moveq #0,d1
bset d5,d1
move.w d1,$dff096 ;Turn Off DMA
moveq #0,d1
move.b curoff(pc),d1
move.w d1,$20(a0)
st $1e(a0)
move.l a1,8(a0)
bra.w fp3de
FP23C moveq #0,d0
moveq #0,d1
moveq #0,d2
moveq #0,d3
move.w $3a(a0),d0
addq.w #2,d0
FP24A move.l (a0),a3
add.l d0,a3
move.w (a3),d2
cmp.w #-1,d2
beq.b fp28e
tst.w d2
bmi.b fp27e
move.w d0,$3a(a0)
move.l module(pc),a3
add.l modadd(pc),a3
add.l $8a6-$12(a3),a3
sub.l modadd(pc),a3
add.l d2,a3
move.l a3,8(a0)
move.w #1,$20(a0)
bra.w fp0ba
FP27E bclr #15,d2
move.w d2,d0
and.l #$ffff,d0
bra.b fp24a
FP28E lea fplayit(pc),a2
move.b #$ff,(a2)
move.w #0,$dff0a8
move.w #0,$dff0b8
move.w #0,$dff0c8
move.w #0,$dff0d8
move.w #15,$dff096
rts
FP2C0 move.l a1,8(a0)
move.b d0,$19(a0)
sf $2f(a0)
move.b $26(a5),$30(a0)
move.b 10(a5),$10(a0)
move.b 12(a5),$12(a0)
move.b 13(a5),$13(a0)
st $22(a0)
move.b #0,$14(a0)
cmp.b #1,$27(a5)
beq.b fp306
cmp.b #2,$27(a5)
beq.b fp31e
bra.b fp336
FP306 tst.b d7
bne.b fp316
btst #1,$2e(a5)
beq.b fp336
FP316 bsr.w fp782
bra.b fp336
FP31E tst.b d7
bne.b fp32e
btst #3,$2e(a5)
beq.b fp336
FP32E bsr.w fp7d0
FP336 moveq #0,d1
move.b curoff(pc),d1
move.w d1,$20(a0)
move.l module(pc),a2
add.l (a5),a2
tst.b $27(a5)
beq.b fp354
lea $40(a0),a2
FP354 btst d5,chan
beq.b fp354a
move.l a2,$a0(a6) ;Address
move.w 6(a5),$a4(a6) ;Length
FP354a moveq #0,d1
move.b d1,$2c(a0)
move.w d1,$a8(a6) ;Volume
move.b #0,$2d(a0)
move.b $13(a5),$2e(a0)
moveq #0,d0
lea multab(pc),a2
move.w 8(a5),d1
moveq #10,d2
move.b $19(a0),d0
lsl.w #1,d0
move.w (a2,d0.w),d0
mulu d1,d0
lsr.l d2,d0
btst d5,chan
beq.b fp354b
move.w d0,$a6(a6) ;Period
FP354b move.w d0,$1c(a0)
tst.b $15(a0)
beq.b fp3c0
tst.w $24(a0)
bne.b fp3c0
move.w $1a(a0),d0
sub.w $1c(a0),d0
move.w d0,$26(a0)
move.w #1,$28(a0)
move.w $1c(a0),$24(a0)
FP3C0 move.b chan(pc),d1
btst d5,d1
beq.b fp3de
move.w #$8200,d1
bset d5,d1
move.w d1,$dff096 ;Turn On DMA
sf $1e(a0)
bra.b fp3e4
FP3DE dbra d5,fp0ba
rts
FP3E4 btst d5,$dff003 ;Check DMA Bit (DMACONR)
beq.b fp3de
moveq #0,d0
move.b $19(a0),d0
moveq #0,d1
move.b $2f(a0),d1
move.b $16(a5,d1.w),d2
add.b d2,d0
subq.b #1,$30(a0)
bne.b fp424
move.b $26(a5),$30(a0)
addq.b #1,$2f(a0)
move.b $33(a5),d3
cmp.b $2f(a0),d3
bne.b fp424
move.b #0,$2f(a0)
FP424 lea multab(pc),a2
move.w 8(a5),d1
moveq #10,d2
lsl.w #1,d0
move.w (a2,d0.w),d0
mulu d1,d0
lsr.l d2,d0
move.w d0,$1c(a0)
tst.b $15(a0)
beq.b fp482
tst.w $16(a0)
beq.b fp454
subq.w #1,$16(a0)
bra.b fp482
FP454 moveq #0,d1
move.w $28(a0),d1
muls $26(a0),d1
divs $2a(a0),d1
add.w d1,$1c(a0)
add.w #1,$28(a0)
move.w $28(a0),d2
cmp.w $2a(a0),d2
ble.b fp482
move.b $23(a0),$19(a0)
sf $15(a0)
FP482 move.w $1c(a0),d0
tst.b $10(a0)
beq.b fp496
subq.b #1,$10(a0)
bra.b fp4fa
FP496 tst.b $22(a0)
beq.b fp4fa
bpl.b fp4c2
moveq #0,d1
move.b $14(a0),d1
add.b $12(a0),d1
move.b d1,$14(a0)
cmp.b $13(a0),d1
bne.b fp4d8
bchg #7,$22(a0)
bra.b fp4d8
FP4C2 move.b $14(a0),d1
sub.b $12(a0),d1
move.b d1,$14(a0)
bne.b fp4d8
bchg #7,$22(a0)
FP4D8 tst.b $14(a0)
bne.b fp4e6
bchg #0,$22(a0)
FP4E6 ext.w d1
btst #0,$22(a0)
beq.b fp4f8
add.w d1,d0
bra.b fp4fa
FP4F8 sub.w d1,d0
FP4FA btst d5,chan
beq.b fp4faa
move.w d0,$a6(a6) ;Period
FP4FAa tst.b $2d(a0)
beq.b fp52a
cmp.b #1,$2d(a0)
beq.b fp556
cmp.b #2,$2d(a0)
beq.b fp582
cmp.b #3,$2d(a0)
beq.b fp59c
bra.w fp5c8
FP52A moveq #0,d0
moveq #0,d1
moveq #0,d2
move.b 15(a5),d2
move.b $10(a5),d1
move.b $2c(a0),d0
add.w d2,d0
move.b d0,$2c(a0)
cmp.w d1,d0
blt.b fp5c8
move.b d1,$2c(a0)
move.b #1,$2d(a0)
bra.b fp5c8
FP556 moveq #0,d0
moveq #0,d1
moveq #0,d2
move.b $11(a5),d2
move.b $12(a5),d1
move.b $2c(a0),d0
sub.w d2,d0
move.b d0,$2c(a0)
cmp.w d1,d0
bgt.b fp5c8
move.b d1,$2c(a0)
move.b #2,$2d(a0)
bra.b fp5c8
FP582 tst.b $2e(a0)
bne.b fp594
move.b #3,$2d(a0)
bra.b fp5c8
FP594 subq.b #1,$2e(a0)
bra.b fp5c8
FP59C moveq #0,d0
moveq #0,d1
moveq #0,d2
move.b $14(a5),d2
move.b $15(a5),d1
move.b $2c(a0),d0
sub.w d2,d0
move.b d0,$2c(a0)
cmp.w d1,d0
bgt.b fp5c8
move.b d1,$2c(a0)
move.b #4,$2d(a0)
FP5C8 moveq #0,d0
moveq #0,d1
moveq #0,d2
moveq #0,d4
move.b $2c(a0),d0
move.b 14(a5),d1
lea d800(pc),a3
move.w (a3),d2
move.b d7ff(pc),d3
tst.b d3
beq.b fp608
move.b d802(pc),d4
sub.w d4,d2
tst.w d2
bmi.b fp5fa
move.w d2,(a3)
bra.b fp608
FP5FA clr.w (a3)
clr.l d2
lea fplayit(pc),a3
move.b #$ff,(a3)
rts
FP608 mulu d2,d1
lsr.l #8,d1
lsr.l #4,d1
mulu d1,d0
lsr.l #8,d0
lsr.l #1,d0
btst d5,chan
beq.b fp608a
movem.l d0/a5,-(sp)
move.l global(pc),a5
move.l APG_CalcVolume(a5),a5
jsr (a5) ;Calculate The New Volume
move.w d0,$a8(a6) ;Volume
movem.l (sp)+,d0/a5
FP608a tst.b $27(a5)
bne.b fp624
bra.w fp3de
FP624 cmp.b #2,$27(a5)
beq.w fp6ce
tst.b $32(a0)
beq.b fp63e
subq.b #1,$32(a0)
bra.w fp3de
FP63E tst.b $34(a0)
beq.b fp64e
subq.b #1,$34(a0)
bra.w fp3de
FP64E btst #0,$2e(a5)
beq.b fp660
tst.b $3c(a0)
beq.w fp770
FP660 move.b $2a(a5),$34(a0)
moveq #0,d0
moveq #0,d1
moveq #0,d2
move.b $31(a0),d0
move.b $2b(a5),d1
move.b $2c(a5),d2
lea $40(a0),a2
btst #2,$33(a0)
bne.b fp698
FP686 cmp.b d2,d0
ble.b fp6ae
bset #2,$33(a0)
subq.b #1,$3c(a0)
subq.b #1,d0
FP698 cmp.b d1,d0
bge.b fp6be
bclr #2,$33(a0)
subq.b #1,$3c(a0)
addq.b #1,d0
bra.b fp686
FP6AE move.b $28(a5),(a2,d0.w)
addq.b #1,d0
move.b d0,$31(a0)
bra.w fp3de
FP6BE move.b $29(a5),(a2,d0.w)
subq.b #1,d0
move.b d0,$31(a0)
bra.w fp3de
FP6CE tst.b $39(a0)
beq.b fp6de
subq.b #1,$39(a0)
bra.w fp3de
FP6DE btst #2,$2e(a5)
beq.b fp6f0
tst.b $3d(a0)
beq.b fp770
FP6F0 tst.b $38(a0)
bne.b fp72c
moveq #0,d1
move.b $2f(a5),d1
moveq #1,d0
lsl.l d1,d0
cmp.w $36(a0),d0
beq.b fp774
moveq #0,d3
addq.w #1,$36(a0)
move.w $36(a0),d3
lea $40(a0),a4
move.l module(pc),a3
add.l (a5),a3
lea $20(a3),a2
moveq #32-1,d2
bra.b fp75c
FP72C moveq #0,d0
move.w $36(a0),d0
cmp.w #1,d0
beq.b fp774
moveq #0,d3
subq.w #1,$36(a0)
move.w $36(a0),d3
lea $40(a0),a4
move.l module(pc),a3
add.l (a5),a3
lea $20(a3),a2
moveq #32-1,d2
FP75C moveq #0,d6
move.b $2f(a5),d6
FP762 move.l d3,d1
muls (a2)+,d1
lsr.l d6,d1
add.b (a3)+,d1
move.b d1,(a4)+
dbra d2,fp762
FP770 bra.w fp3de
FP774 eor.b #1,$38(a0)
subq.b #1,$3d(a0)
bra.w fp6de
FP782 moveq #0,d1
moveq #0,d2
moveq #0,d3
move.b $31(a5),$3c(a0)
move.b $2d(a5),$32(a0)
move.b $2a(a5),$34(a0)
move.b #0,$33(a0)
move.b $2b(a5),$31(a0)
lea $40(a0),a4
move.w 6(a5),d1
add.b d1,d1
move.b d1,d2
move.b $2b(a5),d3
subq.b #1,d3
FP7B8 move.b $28(a5),(a4)+
dbra d3,fp7b8
sub.b $2b(a5),d1
subq.b #1,d1
FP7C6 move.b $29(a5),(a4)+
dbra d1,fp7c6
rts
FP7D0 move.b #0,$38(a0)
move.w #1,$36(a0)
move.b $32(a5),$3d(a0)
move.b $30(a5),$39(a0)
move.l module(pc),a3
add.l (a5),a3
lea $40(a0),a4
moveq #32-1,d1
FP7F6 move.b (a3)+,(a4)+
dbra d1,fp7f6
rts
;------------------------------------------------------------------------------
SECTION FredData,BSS_C
V1STR ds.b 128
V2STR ds.b 128
V3STR ds.b 128
V4STR ds.b 128
EMPSAMP ds.w $32
;------------------------------------------------------------------------------
SLUT